//
//  Grid.m
//  ios_news
//
//  Created by Han on 14-6-24.
//  Copyright (c) 2014年 ucoder. All rights reserved.
//

#import "Grid.h"

@implementation Grid


- (instancetype)initWithAttributes:(NSDictionary *)attributes id:(int) i
{
    self = [super init];
    if (!self) {
        return nil;
    }
    
    self.id = i;
    self.iconImageName = [attributes valueForKeyPath:@"icon_image_name"];
    self.iconTitle = [attributes valueForKeyPath:@"icon_title"];
    
    //self.user = [[User alloc] initWithAttributes:[attributes valueForKeyPath:@"user"]];
    
    return self;
}

+ (NSMutableArray *)getData
{
    /*
    NSArray *dataList = [[NSArray alloc]initWithObjects:@"收藏",@"白天",@"设置",@"文字模式",@"离线",@"行情刷新",@"精品推荐",@"亲，给见闻君五星好评", nil];
    
    NSArray *iconList = [[NSArray alloc]initWithObjects:@"collect",@"night",@"setting",@"fontmode",@"offline",@"refresh",@"instrduce",@"evaluate", nil];
     */
    
    NSArray *dataList = [[NSArray alloc]initWithObjects:@"收藏",@"活动",@"反馈",@"声明",@"更新",@"清理缓存", nil];
    
    NSArray *iconList = [[NSArray alloc]initWithObjects:@"collect",@"activity",@"offline",@"evaluate",@"setting",@"refresh", nil];
    
    NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:[dataList count]];
    
    for (int i = 0; i < dataList.count; i++) {
        
        NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[dataList objectAtIndex:i], @"icon_title", [iconList objectAtIndex:i], @"icon_image_name", nil];
        
        Grid *grid = [[Grid alloc] initWithAttributes:attributes id:i];
        [mutableArray addObject:grid];
    }
    return mutableArray;
}

@end
